package comment

import (
	"github.com/flipped-aurora/gin-vue-admin/server/middleware"
	"github.com/gin-gonic/gin"
)

type CommentRouter struct {
}

func (c CommentRouter) InitCommentRouter(router *gin.RouterGroup) {

	//commentCRouter := router.Group("c").Use(middleware.JWTAuth())
	commentCRouter := router.Group("c")
	commentAdminRouter := router.Group("admin").Use(middleware.JWTAuth())

	{
		// 获取评论列表,内容模糊查询
		commentAdminRouter.GET("getListByContent", commentApi.GetByFuzzy)
		// 获取评论列表,用户名查询
		commentAdminRouter.GET("getListByUserName", commentApi.GetByUserName)
		// 获取评论,评论id查询
		commentAdminRouter.GET("getCommentById", commentApi.GetByAuthorityId)
		// 删除评论,评论id删除
		commentAdminRouter.POST("deleteComment", commentApi.DeleteComment)
	}
	{
		// 通过评论id,获取评论详情
		commentCRouter.GET("getCommentDetail", commentApi.DetailComment)
		// 通过评论id,统计点击数量
		commentCRouter.POST("postClickCount", commentApi.ClickCount)
		// 通过评论id,删除自己的评论
		commentCRouter.POST("deleteComment", commentApi.DeleteCComment)
		// 查询评论列表
		commentCRouter.GET("getComments", commentApi.GetCommentList)
		// 发布评论
		commentCRouter.POST("publishComment", commentApi.AddComment)
		// 修改评论（暂未使用）
		commentCRouter.POST("updateComment", commentApi.UpdateComment)
		// 查询用户评论操作记录
		commentCRouter.GET("getCommentUserAction", commentApi.GetCommentUserAction)
	}
}
